﻿@model ManageLoginsViewModel
@using Microsoft.AspNetCore.Authentication
@{
    ViewData["Title"] = "Manage your external logins";
}
<div class="row">
    <div class="col-md-3">
        <partial name="_AccountMenu" />
    </div>
    <div class="col-md-9">
        <p class="text-success">@ViewData["StatusMessage"]</p>
        <h2>@ViewData["Title"].</h2>
        @if (Model.CurrentLogins.Count > 0)
        {
            <h4>Registered Logins</h4>
            <table class="table">
                <tbody>
                    @for (var index = 0; index < Model.CurrentLogins.Count; index++)
                    {
                        <tr>
                            <td>@Model.CurrentLogins[index].LoginProvider</td>
                            <td>
                                @if ((bool)ViewData["ShowRemoveButton"])
                                {
                                    <form asp-area="Core" asp-controller="Manage" asp-action="RemoveLogin" method="post" class="form-horizontal">
                                        <div>
                                            <input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" />
                                            <input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" />
                                            <input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" />
                                        </div>
                                    </form>
                                }
                                else
                                {
                                    @: &nbsp;
                                }
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        }
        @if (Model.OtherLogins.Count > 0)
        {
            <h4>@Localizer["Add another service to log in."]</h4>
            <hr />
            <form asp-area="Core" asp-controller="Manage" asp-action="LinkLogin" method="post" class="form-horizontal">
                <div id="socialLoginList">
                    <p>
                        @foreach (var provider in Model.OtherLogins)
                         {
                            <button type="submit" class="btn btn-default" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.Name</button>
                        }
                    </p>
                </div>
            </form>
        }
    </div>
</div>



